<? echo $this->partial('partials/_backTo.phtml'); ?>

<div class="full vpad_10 last fixed">
    <? echo $this->partial('partials/_sectionTitle.phtml', 
            array('title'=> 'Zdefiniowane towary')); ?>
     <?php if(empty($this->commodities)) { ?>
     
     <div class="warning">
         <p>Nie zdefiniowałeś jeszcze żadnego towaru</p>
     </div>
     
     <?php } else { ?>
     <table class="datalist" width="100%">
   <caption>
       Towary
   </caption>
   <thead>
      <tr>
         <th>#</th>
         <th scope="col">Nazwa</th>
         <th scope="col">Typ</th>
         <th scope="col">Opis</th>
         <th scope="col">Edytuj</th>
         <th scope="col">Kasuj</th>
      </tr>
   </thead>
   <tfoot>
      <tr>
         <th>&nbsp;</th>
         <th>&nbsp;</th>
         <th>&nbsp;</th>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>

      </tr>
   </tfoot>
   <tbody>
       <?php foreach ($this->commodities as $commodity) { ?> 
      <tr>
         <th style="width:5%" scope="row">
             <?php echo $commodity->getCommodity_id(); ?>
         </th>
         <td style="width:19%" >
             <?php echo $commodity->getName(); ?>
         </td>
         <td style="width:19%" >
             <?php echo $commodity->getCommodityTypeName(); ?>
         </td>
         <td style="width:19%" >
             <center>
                <a class="styled_button view_button grey nyroModal" href="
                    <? echo $this->url(
                            array('controller' => 'commodities', 
                                'action' => 'show',
                                'id'=>$commodity->getCommodity_id(),
                                'format' => 'html'), 
                                null, 
                                true); ?>">
                    Opis towaru
                </a>
             </center>
         </td>
         <td style="width:19%" >
             <center>
                <a class="styled_button edit_button grey" href="
                    <? echo $this->url(
                            array('controller' => 'commodities', 
                                'action' => 'edit',
                                'id'=>$commodity->getCommodity_id()), 
                                null, 
                                true); ?>">
                    Edytuj towar
                </a>
             </center>
         </td>
         <td style="width:19%" >
             <center>
                <a class="styled_button delete_button grey" href="
                    <? echo $this->url(
                            array('controller' => 'commodities', 
                                'action' => 'delete',
                                'id'=>$commodity->getCommodity_id()), 
                                null, 
                                true); ?>">
                    Kasuj towar
                </a>
             </center>
         </td>
      </tr> 
      <?php } ?>

   </tbody>
   <?php }?>
</table>
         
     <br />    
    <? echo $this->partial('partials/_sectionTitle.phtml', 
            array('title'=> 'Nowy towar')); ?>
     
     <?php echo $this->form ?>
          <br /> 
</div>